<template>
    <div class="home">
          <postHead active="home" :showAction="true"></postHead>
          <div class="home_main">
              <div class="hm_left">
                  <div class="hml_div">
                      <div class="hmld_head">
                          <span>投递统计:</span>
                          <div class="hmld_left">
                              <span>2025</span>
                              <i class="iconfont icon-xiangxia"></i>
                          </div>
                      </div>
                      <div class="hml_content">
                          <span>总投递岗位:</span>
                          <span>{{totalInfo.readNum}}个</span>
                      </div>
                      <div class="hml_content">
                          <span>推荐岗位:</span>
                          <span>{{totalInfo.arws}}个</span>
                      </div>
                      <div class="hml_content">
                          <span>推荐人才:</span>
                          <span>{{totalInfo.oscd}}人</span>
                      </div>
                      
                  </div>
  
                  <div class="hml_div" style="margin-top: 32px;">
                      <div class="hmld_head">
                          <span>悬赏招聘:</span>
                          
                      </div>
                      <div class="hml_content">
                          <span>总获得悬赏金:</span>
                          <span>0元</span>
                      </div>
                      <div class="hml_content">
                          <span>实际发放悬赏金:</span>
                          <span>0元</span>
                      </div>
                      <div class="hml_content">
                          <span>未发放悬赏金:</span>
                          <span>0人</span>
                      </div>
                      
                      
                  </div>
              </div>
              <div class="hm_right">
                  <div class="hmr_head">
                      <div class="hmrh_div">
                          <span>0</span>
                          <span>季投递</span>
                      </div>
                      <div class="hmrh_div">
                          <span>0</span>
                          <span>企业邀约的岗位</span>
                      </div>
                      <div class="hmrh_div">
                          <span>0</span>
                          <span>面试通知</span>
                      </div>
                      <div class="hmrh_div">
                          <span>0</span>
                          <span>收藏的岗位</span>
                      </div>
                      <div class="hmrh_div">
                          <span>0</span>
                          <span>收藏的企业</span>
                      </div>
                  </div>
                  <div class="hmr_content">
                      <div class="hmrc_head">
                          <div class="hmrch_left">
                              <el-input v-model="input" placeholder="请输入关键字搜索" style="width: 250px;"></el-input>
                            
                            
                              <div class="hmrch_btn">
                                  <span></span>
                              </div>
                          </div>
                         
                      </div>
                      <div class="hmrc_body">
                          <el-table :data="tableData" border style="width: 100%">
                              <el-table-column 
                                  
                                  label="选择"
                                  width="58">
                              </el-table-column>
                              <el-table-column
                          
                                  label="职位名称"
                                 >
                              </el-table-column>
                              <el-table-column
                              
                                  label="公司名称">
                                  
                              </el-table-column>
                              <el-table-column
                              
                                  label="职位年薪">
                                  
                              </el-table-column>
                              <el-table-column
                              label="工作地点">
                                  
                              </el-table-column>
                              <el-table-column
                              
                                  label="刷新时间"
                                 >
                                  
                              </el-table-column>
                            
                              <el-table-column
                              
                                  label="悬赏金"
                                 >
                                  
                              </el-table-column>
                          
                              <el-table-column
                              
                                  label="投递状态"
                                  w>
                                  
                              </el-table-column>
                             
                         
                              <el-table-column
                              
                                label="操作"
                                >
                                
                            </el-table-column>
  
                          </el-table>
                      </div>
                  </div>
              </div>
          </div>
    </div>
  </template>
  
  <script>
  // @ is an alias to /src
  import postHead  from '@/components/userHead.vue';
   import homeapi from '@/api/api.js'
  export default {
      name: 'HomeView',
      data(){
          return {
              companyInfo:{},
              input:"",
              value:"",
              tableData:[],
              totalInfo:{},
          }
      },
      components: {
          postHead
      },
      mounted(){
          this.getDictList();
          this.getCompanyInfo();
          this.getFunctionList();
          this.getCompanyTotal();
      },
      methods:{
              toAddPost(){
                  this.$router.push("/post/add")
              },
  
                //获取字典
                async getDictList(){
                  let data=await homeapi.getDictList();
                  if(data.code==200){
                      this.columnsData=data.result
                  }
              },
              //获取企业信息
              async getCompanyInfo(){
                  let data=await homeapi.getCompanyInfo();
                  if(data.code==200){
                      this.companyInfo=data.result;
                  }
              },
  
              //获取首页统计信息
              async getCompanyTotal(){
                  let year=2025
                  let data=await homeapi.getCompanyTotal({year});
                  if(data.code==200){
                      this.totalInfo=data.result
                  }
              },
  
              //获取职能列表
              async getFunctionList(){
                  let data=await homeapi.getFunctionList();
                  if(data.code==200){
                      data.result.map(res=>{
                          res.text=res.name;
                          if(res.child.length>0){
                              res.child.map(json=>{
                                  json.text=json.name
                              })
                              res.children=res.child;
                              res.children.map(json=>{
                                  if(json.child.length>0){
                                      json.child.map(item=>{
                                          item.text=item.name
                                      })
                                      json.children=json.child
  
                                  }
                                  else{
                                      json.children=[
                                          {
                                              text:json.text,
                                              id:json.id
                                          }
                                      ]
                                  }
                              })
                          }
                          else{
                              res.children=[
                                  {
                                      text:res.text,
                                      children:[{
                                          text:res.text,
                                          id:res.id
                                      }]
                                  }
                              ]
                          }
                      })
                      
                      this.enterpriseIndustry=data.result
                  }
              },
      }
  }
  </script>
  <style scoped>
      .home_main{
          width: 100%;
          height: calc(100vh - 85px);
          display: flex;
          align-items: center;
          justify-content: flex-start;
          padding: 0 16px;
          box-sizing: border-box;
      }
      .hm_left{
          width: 230px;
          min-width: 230px;
          height: 100%;
          background: #FFFFFF;
          border-radius: 0px 0px 0px 0px;
          padding: 0 16px;
          box-sizing: border-box;
          margin-top: 16px;
      }
      .hm_right{
          flex: 1;
          margin-left: 16px;
          height: 100%;
      }
      .hml_div{
          width: 100%;
          display: inline-block;
          margin-top: 16px;
      }
      .hmld_head{
          width: 100%;
          display: flex;
          align-items: center;
          justify-content: flex-start;
          font-size: 14px;
          color: #333333;
          font-weight: bold;
      }
      .hmld_left{
          display: flex;
          align-items: center;
          justify-content: flex-start;
          font-size: 14px;
          margin-left: 8px;
      }
      .hmld_left .iconfont{
          font-size: 14px;
          margin-left: 8px;
          color: #999999;
      }
      .hml_content{
          width: 100%;
          display: flex;
          align-items: center;
          justify-content: flex-start;
          line-height: 18px;
          margin-top: 8px;
      }
      .hml_content span:first-child{
          font-size: 14px;
          color: #333333;
      }
      .hml_content span:last-child{
          font-size: 14px;
          font-weight: bold;
          margin-left: 8px;
      }
      .hmr_head{
          width: 100%;
          display: flex;
          align-items: center;
          justify-content: flex-start;
          margin-top: 16px;
      }
      .hmrh_div{
          flex: 1;
          height: 122px;
          background: #FFFFFF;
          border-radius: 0px 0px 0px 0px;
          display: flex;
          align-items: center;
          justify-content: center;
          flex-direction: column;
          font-size: 24px;
          color: #333333;
          font-weight: bold;
          line-height: 32px;
          margin-left: 16px;
      }
      .hmrh_div:first-child{
          margin-left: 0px;
      }
      .hmrh_div span:last-child{
          font-size: 14px;
          color: #333333;
          line-height: 18px;
          margin-top: 8px;
          font-weight: 400;
      }
      .hmr_content{
          width: 100%;
          height: calc(100% - 144px);
          margin-top: 16px;
          background: #FFFFFF;
          display: inline-block;
      }
      .hmrc_head{
          width: 100%;
          display: flex;
          align-items: center;
          justify-content: space-between;
          margin-top: 32px;
          padding: 0 32px;
          box-sizing: border-box;
      }
      .hmrch_left{
          display: flex;
          align-items: center;
          justify-content: flex-start;
      }
      .select_div{
          display: flex;
          align-items: center;
          justify-content: flex-start;
          margin-left: 16px;
          font-size: 16px;
      }
      .select_div_label{
          margin-right:8px;
      }
      .hmrch_right{
          display: flex;
          align-items: center;
          justify-content: flex-end;
      }
      .hmrchr_div{
          width: 72px;
          height: 34px;
          background: #F5792A;
          border-radius: 0px 0px 0px 0px;
          display: flex;
          align-items: center;
          justify-content: center;
          font-size: 14px;
          color: #FFFFFF;
          margin-right: 16px;
          cursor: pointer;
      }
      .hmrc_body{
          width: 100%;
          padding: 0 16px;
          box-sizing: border-box;
          margin-top: 16px;
      }
  </style>
  